/* 背景样式 */
.bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(45deg, #1a1a2e 0%, #16213e 100%);
    transition: all 5s ease;
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 初始背景 */
body {
    background: linear-gradient(45deg, #1f1f1f 0%, #111 100%);
}

/* 星星背景 */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
}

/* 月亮 */
.moon {
    position: absolute;
    top: 10%;
    right: 10%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at center,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.6) 40%,
        rgba(255, 255, 255, 0.2) 70%,
        transparent 100%);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 2s ease;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
}

/* 云层 */
.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    opacity: 0;
    transition: all 2s ease;
}

/* 音乐播放时的背景效果 */
body.music-playing .bg-wrapper {
    background: linear-gradient(45deg, #0a192f 0%, #20314f 100%);
}

body.music-playing .moon {
    opacity: 1;
    transform: scale(1);
}

body.music-playing .clouds {
    opacity: 1;
    animation: cloudMove 20s linear infinite;
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    color: white;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    max-width: 500px;
    width: 100%;
    margin: 20px;
}

/* 蛋糕容器 */
.cake-wrapper {
    position: relative;
    height: 175px;
    margin: 2rem 0;
    perspective: 1000px;
}

.cake {
    position: relative;
    width: 250px;
    height: 200px;
    margin: 0 auto;
    transform-style: preserve-3d;
    animation: float 3s ease-in-out infinite;
}

/* 蛋糕主体 */
.cake-body {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
}

.layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px;
    background: #fff5e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.layer.top {
    width: 180px;
    height: 60px;
    bottom: 120px;
    background: linear-gradient(to right, #ffe0e0, #ffb3b3);
}

.layer.middle {
    width: 220px;
    height: 65px;
    bottom: 60px;
    background: linear-gradient(to right, #fff0f0, #ffd6d6);
}

.layer.bottom {
    width: 250px;
    height: 70px;
    bottom: 0;
    background: linear-gradient(to right, #fff5f5, #ffe6e6);
}

/* 奶油装饰 */
.icing {
    position: absolute;
    width: 100%;
    height: 15px;
    top: -10px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
}

.drip {
    position: absolute;
    top: 0;
    width: 100%;
    height: 20px;
    background: 
        radial-gradient(circle at 10% 15%, white 20%, transparent 21%),
        radial-gradient(circle at 30% 15%, white 20%, transparent 21%),
        radial-gradient(circle at 50% 15%, white 20%, transparent 21%),
        radial-gradient(circle at 70% 15%, white 20%, transparent 21%),
        radial-gradient(circle at 90% 15%, white 20%, transparent 21%);
    background-size: 20% 100%;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

/* 夹心层 */
.filling {
    position: absolute;
    width: 100%;
    height: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(to right, #ff9999, #ff6666);
}

/* 装饰品 */
.decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.strawberries {
    position: absolute;
    top: -105px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    font-size: 24px;
}

.blueberries {
    position: absolute;
    top: -152px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    font-size: 20px;
}

/* 蜡烛 */
.candles {
    position: absolute;
    top: -220px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    display: flex;
    justify-content: space-between;
}

.candle {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.5s ease;
}

.stick {
    width: 6px;
    height: 30px;
    background: linear-gradient(to bottom, #ffd1a1 0%, #ffaf4d 100%);
    border-radius: 4px;
}

.flame-wrap {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    transform-style: preserve-3d;
}

.flame {
    width: 12px;
    height: 25px;
    background: radial-gradient(ellipse at bottom, #ffdb6f, #ff9933);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform-origin: center bottom;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow {
    position: absolute;
    top: -10%;
    left: -30%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at center, rgba(255,255,150,0.4), transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 盘子 */
.plate {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 20px;
    background: linear-gradient(to bottom,
        rgba(255,255,255,0.4),
        rgba(255,255,255,0.1)
    );
    border-radius: 50%;
    filter: blur(1px);
}

/* 音乐播放时的效果 */
body.music-playing .flame,
body.music-playing .glow {
    opacity: 1;
    animation: flicker 2s ease-in-out infinite;
}

/* 动画效果 */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes flicker {
    0%, 100% {
        transform: scale(1) rotate(-4deg);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.1) rotate(4deg);
        filter: brightness(1.1);
    }
    50% {
        transform: scale(0.9) rotate(-2deg);
        filter: brightness(0.9);
    }
    75% {
        transform: scale(1.2) rotate(2deg);
        filter: brightness(1.2);
    }
}

/* 按钮样式 */
.music-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.music-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 容器样式 */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* 3D场景容器 */
.card-scene {
    width: 100%;
    max-width: 500px;
    height: 600px;
    perspective: 1000px;
}

/* 卡片容器 */
.birthday-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.birthday-card.flipped {
    transform: rotateY(180deg);
}

/* 卡片正面和背面的共同样式 */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 卡片背面 */
.card-back {
    transform: rotateY(180deg);
}

/* 卡片内容布局 */
.card-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: white;
}

/* 祝福文字样式 */
.wishes {
    text-align: center;
    font-size: 1.2rem;
    line-height: 2;
    margin: 2rem 0;
}

/* 签名样式 */
.signature {
    text-align: right;
    margin-top: 2rem;
}

.sign-name {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

/* 控制按钮容器 */
.controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* 按钮样式 */
.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.2rem;
} 